FROM debian:7.8

# install python2.7
RUN apt-get update -y && apt-get install --no-install-recommends -y -q build-essential python2.7 python2.7-dev python-pip git
RUN pip install -U pip
RUN pip install virtualenv

# install python dependence
RUN apt-get update && apt-get install -y \
        postgresql-client libpq-dev \
        sqlite3 \
        gcc wget procps \
    --no-install-recommends && rm -rf /var/lib/apt/lists/*

# install nginx
RUN echo 'deb http://nginx.org/packages/debian/ wheezy nginx' > /etc/apt/sources.list.d/nginx.list
RUN wget -q http://nginx.org/keys/nginx_signing.key && apt-key add nginx_signing.key && rm -fr nginx_signing.key
RUN apt-get update && apt-get install -y nginx

# set env
ENV PYTHONUNBUFFERED 1

# setup requirements lib
WORKDIR /opt/project
RUN pip install Django==1.7.5
RUN pip install psycopg2==2.5.3
RUN pip install gunicorn==19.3.0
RUN pip install gevent==1.0.1
RUN pip install django-reversion==1.8.5
RUN pip install django-crispy-forms
RUN pip install https://github.com/sshwsfc/django-xadmin/archive/django1.7.zip

VOLUME ["/opt/project", '/scripts', '/opt/log', '/opt/etc', '/opt/data']

CMD ["/bin/bash", "/scripts/start.sh"]
